from django.contrib import admin
from .models import Article


class ArticleAdmin(admin.ModelAdmin):
    list_display = ('id', 'title', 'created_time',)#显示属性
    list_display_links = ('title',)#设置超链接
    search_fields = ('title', 'created_time')
admin.site.register(Article, ArticleAdmin)


# Register your models here.

# class ArticleAdmin(admin.ModelAdmin):
#
#     '''设置列表可显示的字段'''
#     list_display = ('title', 'author',  'status', 'mod_date',)
#
#     '''设置过滤选项'''
#     list_filter = ('status', 'pub_date', )
#
#     '''每页显示条目数'''
#     list_per_page = 5
#
#     '''设置可编辑字段'''
#     list_editable = ('status',)
#
#     '''按日期月份筛选'''
#     date_hierarchy = 'pub_date'
#
#     '''按发布日期排序'''
#     ordering = ('-mod_date',)
#
# admin.site.register(Article, ArticleAdmin)